
import { HttpAnnounceList, HttpReadAnnounce } from '../../../service/notice';
// import TableList from "../../../components/templates/tablelist";
import TableList from "../../../components/templates/customtablelist";
import mixin from '../mixin';
import compErpSkuInput from "@components/templates/erpskuinput";
import compDetail from './detailmodal';

export default {
    mixins: [TableList, mixin],
    emits: ['update:modelValue'],
    components: {
        compDetail,
        compErpSkuInput
    },
    data() {
        return {
            isMixin: true,
            Tools: { show: true },
            Tabs: { show: true },
            formData: {
                search: {
                }
            },
            Searchs: {
                show: true,
                labelWidth: 90,
            },
            Plugins: { show: true },
        };
    },
    mounted () {
        this.formData.search.keyword = this.$route.query.keyword
        // this.$set(this.$refs.compSearchs.formData, 'keyword', this.$route.query.keyword)
    },
    methods: {
        ajaxRequest: HttpAnnounceList,
        interceptRequest: (params) => {
            return {
                ...params,
                keyword: params.search.keyword,
                search: {}
            }
        },
        handleOperates(params, type, batch) {
            if (batch === true) {
                params = (params || this.checkedData.join(',')) + '';
                if (!params.length) return this.$Message.warning('请选择至少一条数据');
            }
            switch (type) {
                case 'query':
                    this.operate = {
                        show: true,
                        id: params,
                        page: this.formData.page,
                        row: this.formData.rows,
                        title: "公告",
                        component: "compDetail",
                       	width: '720',
                        showFooter: false
                    };
                    break;
            }
        },
    },
    computed: {
        SearchsData() {
            return [
                {
                    label: "标题",
                    key: 'keyword',
                    tag: 'Input',
                    show: true,
                },
                // {
                //     label: "ERP SKU",
                //     key: "EQ_erpSku",
                //     tag: "div",
                //     removeInput: true,
                //     children: (h) => {
                //         return h(resolveComponent("compErpSkuInput"), {
                //             value: this.formData.EQ_erpSku,
                //             showread: "showyes",
                //             onData: (row) => {
                //                 this.formData.search.EQ_erpSku = row.erpSku;
                //                 this.$refs.compSearchs.formData.EQ_erpSku = row.erpSku;
                //             }
                //         });
                //     },
                //     show: true,
                // }
            ]
        },
        columns() {
            return [
                {
                    type: 'selection',
                    width: 40,
                    align: 'center',
                    formName: 'id'
                },
                {
                    title: '#',
                    type: 'index',
                    width: 50,
                    align: 'center',
                },
                {
                    title: '标题',
                    key: 'title',
                    render: (h, { row }) => {
                        return <span class="color-link" onClick={this.handleOperates.bind(this, row.id, 'query')}>{row.title}</span>
                    },
                },
                {
                    title: '简述',
                    key: 'brief',
                    // render: (h, { row }) => {
                    //     return <div class={{ 'font-bold': row.notifyReadStatus == 0 }}>{row.brief}:{row.srcLabel}</div>
                    // },
                },
                {
                    title: '创建人',
                    width: 100,
                    key: 'createdName'
                },
                {
                    title: '日期',
                    width: 150,
                    key: 'createdAt',
                }];
        },
    },
};




